import sweet.helper.mail._
import sweet.helper.StringHelper._

val props = sweet.helper.JSystem.props
val rt = Runtime.getRuntime
val MB = 1024*1024
val sender = if(args.length>0) new EmailSender(args(0)) else new EmailSender

sender.send(
  "sweet-tester@sweetscala.org", 
  "thebugslayer@gmail.com", 
  "Just a test", 
  """Helo, this is just a email test. 
  |
  |Here are some important information of your system that sends this mail.
  |  Date: %s
  |  OS: %s 
  |  JVM: %s 
  |  JVM Mem Usage: %s 
  """.stripMargin.fmt(
    new java.util.Date, 
    props("os.name")+" "+props("os.arch")+" "+props("os.version"),
    props("java.vm.name")+" "+props("java.vm.version"), 
    Math.round(rt.freeMemory/MB)+"MB/"+Math.round(rt.totalMemory/MB)+"MB"
  )
)
